﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Navegar.UAP.Exemple.CRM.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Format="using:WinRTConverters.Format"
    xmlns:visibility="using:WinRTConverters.Visibility"
    x:Class="Navegar.UAP.Exemple.CRM.Views.ClientPage"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
	<Page.Resources>
		<Format:StringFormatConverter x:Key="StringFormatConverter"/>
        <visibility:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
	</Page.Resources>
    <Page.DataContext>
        <Binding Path="ClientPageViewModelInstance" Source="{StaticResource Locator}"/>
    </Page.DataContext>
    <Page.BottomAppBar>
        <CommandBar>
            <AppBarButton
        		HorizontalAlignment="Left"
        		VerticalAlignment="Top"
        		Command="{Binding SaveCommand}"
        		Icon="Save"
        		Label="Enregistrer" FontFamily="Global User Interface">
            </AppBarButton>
            <AppBarButton
        		HorizontalAlignment="Left"
        		VerticalAlignment="Top"
        		Command="{Binding LoadCommandesCommand}"
        		Icon="Shop"
        		Label="Commandes">
            </AppBarButton>
            <AppBarButton
        		HorizontalAlignment="Left"
        		VerticalAlignment="Top"
        		Command="{Binding CancelCommand}"
        		Icon="Cancel"
        		Label="Fermer" FontFamily="Global User Interface" Visibility="{Binding IsWindowsApp, Converter={StaticResource BooleanToVisibilityConverter}}"/>
        </CommandBar>
    </Page.BottomAppBar>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="120"/>
			<RowDefinition Height="1"/>
			<RowDefinition/>
		</Grid.RowDefinitions>
		<TextBlock Grid.Row="0" Margin="40,40.8,0,40.2" TextWrapping="Wrap" Text="Client" VerticalAlignment="Center" FontSize="32" HorizontalAlignment="Left"/>
		<Line Grid.Row="1" Stroke="White" X2="1" Margin="40,0" Stretch="Fill"/>
		<Grid Margin="40" Grid.Row="2">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>
    	
			<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
				<TextBox FontFamily="Global User Interface" Text="{Binding ClientCurrent.Nom, Mode=TwoWay}" />
				<TextBlock Text="Nom" Style="{StaticResource LabelTextBox}" />
			</StackPanel>

			<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical" Margin="0,40,0,0">
				<TextBox Text="{Binding ClientCurrent.NumeroClient, Mode=TwoWay}" />
				<TextBlock Text="Numéro Client" Style="{StaticResource LabelTextBox}" />
			</StackPanel>

			<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical" Margin="0,40,0,0">
				<TextBox Text="{Binding ClientCurrent.Ville, Mode=TwoWay}" />
				<TextBlock Text="Ville" Style="{StaticResource LabelTextBox}"/>
			</StackPanel>
			<TextBlock Grid.Column="1" HorizontalAlignment="Center" Margin="0" Grid.RowSpan="12" TextWrapping="Wrap" Text="{Binding ClientCurrent.ChiffreAffaire, ConverterParameter='{}{0} €', Converter={StaticResource StringFormatConverter}}" VerticalAlignment="Center" Foreground="#FF1A90C7" FontSize="40"/>
		</Grid>
	</Grid>
</Page>
